// ----导出组件
import type { App } from "vue";

// 常量
export { Constant } from "./constant";

// 接口
export { userLogUser } from "./api/system/userLog/index";
export { rbacApi } from "./api/system/rbac";

// 本地动态路由
import { rbacRouters } from "./router/rbacrouter";

// 添加组件.
import { addViteMenus, i18n, addDynamicRoute } from "jmash-core";
// 本地语言包
import { loadLang } from "./lang";
// 抛出的组件
import ResetPwd from "./components/ResetPwd/index.vue";
// 人员选择组件
import PeopleSelect from "./components/PeopleSelect/index.vue";
// 根据部门选择人员双下拉框
import DeptSelect from "./components/DeptSelect/index.vue";
// 根据部门选择人员弹框组件
import UserSelect from "./components/UserSelect/index.vue";
// 根据部门选择人员弹框组件
import DeptPeopleSelect from "./components/DeptPeopleSelect/index.vue";

export { deptApi } from "./api/system/dept/index";
export type {
  DeptReq,
  DeptModel,
  DeptTreeSelectModel,
} from "./api/system/dept/types";

export { jobApi } from "./api/system/job/index";
export type { JobReq, JobModel } from "./api/system/job/types";

export { roleApi } from "./api/system/role/index";
export type { RoleReq, RoleModel } from "./api/system/role/types";

export { userApi } from "./api/system/user/index";
export type {
  UserReq,
  UserModel,
  SelectUsersModel,
  UserOpenModel,
  UserUpdateReq,
  UserKey,
} from "./api/system/user/types";

// 根据部门选择人员组件
const modules = import.meta.glob("./views/**/**.vue");

// 全局注册Jmash-rbac插件.
const rbac = {
  install(app: App) {
    loadLang(i18n);
    addViteMenus(modules, 7);
    addDynamicRoute(rbacRouters);
    app.component("ResetPwd", ResetPwd);
    app.component("PeopleSelect", PeopleSelect);
    app.component("UserSelect", UserSelect);
    app.component("DeptSelect", DeptSelect);
    app.component("DeptPeopleSelect", DeptPeopleSelect);
  },
};
export default rbac;
